package com.sky.controller.admin;



import com.sky.result.Result;
import com.sky.server.ReportService1;
import com.sky.vo.SalesTop10ReportVO;
import com.sky.vo.UserReportVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/admin/report")
@Slf4j
public class ReportController1 {

    @Autowired
    private ReportService1 reportService1;

    //销量前十数据
    @GetMapping("/top10")
    public Result<SalesTop10ReportVO> selectTop10(String begin,String end){
        SalesTop10ReportVO salesTop10ReportVO = reportService1.selectTop10(begin,end);
        return Result.success(salesTop10ReportVO);
    }

    //用户总量与新增用户
    @GetMapping("/userStatistics")
    public Result<UserReportVO> selectUserStatistics(String begin, String end){
        UserReportVO userReportVO = reportService1.selectUserStatistics(begin,end);
        return Result.success(userReportVO);
    }

    //导出报表
    @GetMapping("/export")
    public void getExport(HttpServletResponse response){
        reportService1.getExport(response);

    }
}
